Conditionally change a control's appearance
This topic describes the steps to conditionally change a control's appearance (e.g. make a label's text red if its value exceeds some threshold). Because of the formatting rules feature, scripts are not required to achieve this.
To conditionally change a control's appearance:
- Click the report's Smart Tag, and in the actions list click the ellipsis button for the Formatting Rule Sheet option.
- In the displayed Formatting Rule Sheet Editor, create a new formatting rule (by using ) and click the ellipsis button for its Condition property.
- Then, in the displayed Condition Editor, define the required Boolean condition (which means that its result is returned as either true or false). In this example, we will format fields if the Oil Price value is greater than 30. To save the condition and close the dialog, click OK.
- Now, back in the Formatting Rule Sheet Editor, define the formatting to be applied (e.g. specify the desired font color). To save the changes and quit the dialog, click on Close.
- Finally, select the band or control to which the formatting rule must be applied (in this example it is the Detail band), and via its Smart Tag, access its collection of Formatting Rules.
- In the displayed Formatting Rules Editor, move the rule from left to right for it to come into effect for this band.
- If multiple rules are applied, it is possible to customize their precedence, by using the up and down arrow buttons at the right of the dialog. So, the rules are applied in the same order that they appear in the list, and the last rule in the list has the highest priority.